<template>
	<view class="user-content">
		<view class="user l-whitespace">
			<view class="iconfont icon-set" @click="goSetInfo"></view>
			<view class="user-infos">
				<view class="user-infos-mod" @click="goSetInfo">
					<view class="uim-avatar">
						<image src="../../static/logo.png"></image>
					</view>
					<view class="uim-text">
						<view class="uim-text-name-wrap">
							<text class="uim-text-name">1837*****22</text>
							<view class="iconfont icon-shimingrenzheng"></view>
						</view>
						<text class="uim-text-id">查看并编辑个人资料</text>
					</view>
				</view>
				<view class="user-infos-list">
					<view class="uil-item" v-for="(key, index) in infoItems" :key="index" @click="goInfoItemPage(key.url)">
						<view class="iconfont" :class="key.icon"></view>
						<text>
							{{key.name}}
						</text>
					</view>
				</view>
			</view>
		</view>
		<view class="user-list-wrap">
			<view class="user-list">
				<van-cell
					v-for="(key, index) in listArr1"
					:key="index"
					:title="key.name"
					@click="onNavigateTo(key)"
					is-link
				>
				<view class="iconfont" :class="key.icon" slot="icon"></view>
				</van-cell>
			</view>
		</view>
		<view class="user-list">
			<van-cell
				v-for="(key, index) in listArr2"
				:key="index"
				@click="onNavigateTo(key)"
				:title="key.name"
				:value="key.value"
				is-link>
				<view class="iconfont" :class="key.icon" slot="icon"></view>
			</van-cell>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			infoItems: [
				{
					name: '收款码',
					icon: 'icon-shoukuanma-',
					url: '/pages/home/collection/index'
				},
				{
					name: '邀请码',
					icon: 'icon-yaoqing',
					url: '/pages/home/invite/index'
				},
				{
					name: '人脉',
					icon: 'icon-renmai',
					url: '/pages/user/contacts'
				},
				{
					url: '/pages/home/trading-record/index',
					icon: 'icon-jiaoyijilu',
					name: '交易记录'
				}
			],
			listArr1: [
				{
					name: '个人资产',
					icon: 'icon-wallet-',
					url: '/pages/user/property'
				},
				{
					name: '实名认证',
					icon: 'icon-shimingrenzheng',
					url: '/pages/user/certification'
				},
				{
					name: '交易密码',
					icon: 'icon-drxx25',
					value: '修改',
					url: '/pages/user/reset/resetTradersPwd'
				}
			],
			listArr2: [
				{
					name: '检查更新',
					value: '1.1',
					icon: 'icon-icon--gengxin',
					url: '',
					key: 1
				},
				{
					name: '关于我们',
					icon: 'icon-guanyuwomen',
					url: '/pages/user/about'
				}
			]
		};
	},
	onLoad() {},
	methods: {
		goInfoItemPage (url) {
			uni.navigateTo({
				url: url
			});
		},
		onNavigateTo(key) {
			switch(key.key)
			{
			case 1:
			  this.getUpdate()
			  break;
			case 2:
			  // this.goLogin()
			  break;
			default:
				uni.navigateTo({
					url: key.url
				});
			}
		},
		getUpdate () {
			let content = '当前为最新版本1.1'
			uni.showModal({
				title: '提示',
				content: content,
				showCancel: false,
				success: (res) => {
					if (res.confirm) {
					}
				}
			});
		},
		goSetInfo () {
			uni.navigateTo({
				url: '/pages/user/user-info/index'
			});
		}
	}
};
</script>

<style scoped lang="scss">
	image{
		width: 100%;
		height: 100%;
	}
	.icon-set {
		position: absolute;
		right: 15px;
		top: 15px;
		font-size: 40upx;
		color: #fff;
	}
.user {
	position: relative;
	margin-bottom: 30upx;
	margin-top: 30upx;
	.icon-set {
		position: absolute;
		right: 25px;
		top: 10px;
		font-size: 40upx;
		color: #fff;
	}
	&-list-wrap {
		padding-top: 40upx;
		border-top-left-radius: 20upx;
		border-top-right-radius: 20upx;
		background-color: #fff;
		box-shadow: 0 -10px 15px 0 rgba(234, 234, 234, 0.3);
	}
	&-list {
		margin-bottom: 24upx;
		.user-info-mod {
			display: flex;
			align-items: center;
			text-align: left;
			color: #000;
		}
		.iconfont {
			font-size: 38upx;
			margin-right: 10upx;
		}
	}
	&-avatar {
		direction: flex;
		align-items: center;
		align-content: center;
		image {
			display: block;
			width: 120upx;
			height: 120upx;
		}
	}
	&-info {
		margin-left: 20upx;
		&-name,
		&-id {
			display: block;
			width: 100%;
			line-height: 1.2;
		}
		&-name {
			margin-bottom: 10upx;
			font-size: 38upx;
		}
		&-id {
			font-size: 24upx;
			color: #9b9b9b;
		}
	}
    &-infos {
		padding: 20upx 16upx;
		background: #308afd;
		box-shadow: 0 8upx 20upx 0 rgba(4,103,231, .5);
		border-radius: 10upx;
		&-mod {
			display: flex;
			align-items: center;
			.uim {
				&-avatar {
					width: 100upx;
					height: 100upx;
					margin-right: 12upx;
					border-radius: 100%;
					overflow: hidden;
				}
				&-text {
					&-name-wrap {
						display: flex;
						align-items: center;
						.icon-shimingrenzheng {
							margin-left: 10upx;
							font-size: 34upx;
							color: #ffcc32;
						}
					}
					&-name {
						display: block;
						font-size: 34upx;
						color: #b7d7ff;
					}
					&-id {
						display: block;
						font-size: 20upx;
						color: #486b98;
					}
				}
			}
		}
		&-list {
			display: flex;
			align-items: center;
			margin-top: 30upx;
			color: #90c1fe;
			.uil {
				&-item {
					margin-right: 60upx;
					text-align: center;
					font-size: 24upx;
					.iconfont {
						font-size: 44upx;
						margin-bottom: 10upx;
					}
					text {
						display: block;
					}
					.icon-shoukuanma- {
						color: #fff
					}
					.icon-renmai {
						color: #32b9b5
					}
					.icon-yaoqing {
						color: #c2390d
					}
					.icon-jiaoyijilu {
						color: #21d1a0
					}
				}
			}
		}
	} 
	&-wallet {
		border-radius: 8upx;
		background: #FFFFFF;
		box-shadow: 0 -10px 15px 0 rgba(175,238,193,0.30);
	} 
}
</style>
